<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>numpy.polynomial.chebyshev.Chebyshev.fit &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/language_data.js"></script>
    <script type="text/javascript" src="../../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../../about.html" >
    <link rel="index" title="Index" href="../../genindex.html" >
    <link rel="search" title="Search" href="../../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../../index.html" >
    <link rel="up" title="numpy.polynomial.chebyshev.Chebyshev" href="numpy.polynomial.chebyshev.Chebyshev.html" >
    <link rel="next" title="numpy.polynomial.chebyshev.Chebyshev.fromroots" href="numpy.polynomial.chebyshev.Chebyshev.fromroots.html" >
    <link rel="prev" title="numpy.polynomial.chebyshev.Chebyshev.deriv" href="numpy.polynomial.chebyshev.Chebyshev.deriv.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../../index.html">
      <img border=0 alt="NumPy" src="../../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="../index.html" >NumPy Reference</a></li>
          <li class="active"><a href="../routines.html" >Routines</a></li>
          <li class="active"><a href="../routines.polynomials.html" >Polynomials</a></li>
          <li class="active"><a href="../routines.polynomials.package.html" >Polynomial Package</a></li>
          <li class="active"><a href="../routines.polynomials.chebyshev.html" >Chebyshev Module (<code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.polynomial.chebyshev</span></code>)</a></li>
          <li class="active"><a href="numpy.polynomial.chebyshev.Chebyshev.html" accesskey="U">numpy.polynomial.chebyshev.Chebyshev</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="numpy.polynomial.chebyshev.Chebyshev.fromroots.html" title="numpy.polynomial.chebyshev.Chebyshev.fromroots"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="numpy.polynomial.chebyshev.Chebyshev.deriv.html" title="numpy.polynomial.chebyshev.Chebyshev.deriv"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="numpy.polynomial.chebyshev.Chebyshev.deriv.html"
                        title="previous chapter">numpy.polynomial.chebyshev.Chebyshev.deriv</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="numpy.polynomial.chebyshev.Chebyshev.fromroots.html"
                        title="next chapter">numpy.polynomial.chebyshev.Chebyshev.fromroots</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="numpy-polynomial-chebyshev-chebyshev-fit">
<h1>numpy.polynomial.chebyshev.Chebyshev.fit<a class="headerlink" href="#numpy-polynomial-chebyshev-chebyshev-fit" title="Permalink to this headline">¶</a></h1>
<p>method</p>
<dl class="method">
<dt id="numpy.polynomial.chebyshev.Chebyshev.fit">
<em class="property">classmethod </em><code class="sig-prename descclassname">Chebyshev.</code><code class="sig-name descname">fit</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">y</em>, <em class="sig-param">deg</em>, <em class="sig-param">domain=None</em>, <em class="sig-param">rcond=None</em>, <em class="sig-param">full=False</em>, <em class="sig-param">w=None</em>, <em class="sig-param">window=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/numpy/numpy/blob/v1.18.1/numpy/polynomial/_polybase.py#L810-L898"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numpy.polynomial.chebyshev.Chebyshev.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Least squares fit to data.</p>
<p>Return a series instance that is the least squares fit to the data
<em class="xref py py-obj">y</em> sampled at <em class="xref py py-obj">x</em>. The domain of the returned instance can be
specified and this will often result in a superior fit with less
chance of ill conditioning.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>x</strong><span class="classifier">array_like, shape (M,)</span></dt><dd><p>x-coordinates of the M sample points <code class="docutils literal notranslate"><span class="pre">(x[i],</span> <span class="pre">y[i])</span></code>.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array_like, shape (M,) or (M, K)</span></dt><dd><p>y-coordinates of the sample points. Several data sets of sample
points sharing the same x-coordinates can be fitted at once by
passing in a 2D-array that contains one dataset per column.</p>
</dd>
<dt><strong>deg</strong><span class="classifier">int or 1-D array_like</span></dt><dd><p>Degree(s) of the fitting polynomials. If <em class="xref py py-obj">deg</em> is a single integer
all terms up to and including the <em class="xref py py-obj">deg</em>’th term are included in the
fit. For NumPy versions &gt;= 1.11.0 a list of integers specifying the
degrees of the terms to include may be used instead.</p>
</dd>
<dt><strong>domain</strong><span class="classifier">{None, [beg, end], []}, optional</span></dt><dd><p>Domain to use for the returned series. If <code class="docutils literal notranslate"><span class="pre">None</span></code>,
then a minimal domain that covers the points <em class="xref py py-obj">x</em> is chosen.  If
<code class="docutils literal notranslate"><span class="pre">[]</span></code> the class domain is used. The default value was the
class domain in NumPy 1.4 and <code class="docutils literal notranslate"><span class="pre">None</span></code> in later versions.
The <code class="docutils literal notranslate"><span class="pre">[]</span></code> option was added in numpy 1.5.0.</p>
</dd>
<dt><strong>rcond</strong><span class="classifier">float, optional</span></dt><dd><p>Relative condition number of the fit. Singular values smaller
than this relative to the largest singular value will be
ignored. The default value is len(x)*eps, where eps is the
relative precision of the float type, about 2e-16 in most
cases.</p>
</dd>
<dt><strong>full</strong><span class="classifier">bool, optional</span></dt><dd><p>Switch determining nature of return value. When it is False
(the default) just the coefficients are returned, when True
diagnostic information from the singular value decomposition is
also returned.</p>
</dd>
<dt><strong>w</strong><span class="classifier">array_like, shape (M,), optional</span></dt><dd><p>Weights. If not None the contribution of each point
<code class="docutils literal notranslate"><span class="pre">(x[i],y[i])</span></code> to the fit is weighted by <em class="xref py py-obj">w[i]</em>. Ideally the
weights are chosen so that the errors of the products
<code class="docutils literal notranslate"><span class="pre">w[i]*y[i]</span></code> all have the same variance.  The default value is
None.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 1.5.0.</span></p>
</div>
</dd>
<dt><strong>window</strong><span class="classifier">{[beg, end]}, optional</span></dt><dd><p>Window to use for the returned series. The default
value is the default class domain</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 1.6.0.</span></p>
</div>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl>
<dt><strong>new_series</strong><span class="classifier">series</span></dt><dd><p>A series that represents the least squares fit to the data and
has the domain and window specified in the call. If the
coefficients for the unscaled and unshifted basis polynomials are
of interest, do <code class="docutils literal notranslate"><span class="pre">new_series.convert().coef</span></code>.</p>
</dd>
<dt><strong>[resid, rank, sv, rcond]</strong><span class="classifier">list</span></dt><dd><p>These values are only returned if <em class="xref py py-obj">full</em> = True</p>
<p>resid – sum of squared residuals of the least squares fit
rank – the numerical rank of the scaled Vandermonde matrix
sv – singular values of the scaled Vandermonde matrix
rcond – value of <em class="xref py py-obj">rcond</em>.</p>
<p>For more details, see <em class="xref py py-obj">linalg.lstsq</em>.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>